<template>
    <div class="bar">
        <component :is="currentView"></component>
    </div>
</template>
<style lang="less" scoped>
  .bar {
    height: 100%;
  }
</style>
<script>
  import Vue from 'vue'
  export default {
    name: 'bar',
    data () {
      return {
        currentView: ''
      }
    },
    methods: {
      viewTo () {
        let val = this.$route.params[0];
        this.$set(this,'currentView',val);
        Vue.component(val, () => import('@/view/'+val.replace('m_','')+'/'+val+'.vue'));
      }
    },
    watch: {
      '$route' () {
        this.viewTo()
      }
    },
    mounted () {
      this.viewTo();
    }
  }
</script>
